package com.atchangsha.system.dto;


import com.atchangsha.system.entity.MenusOrderRelationEntity;
import lombok.*;

import java.io.Serializable;

@Data
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class MenusOrderRelationDTO implements Serializable {
    /**
     * 主键
     */
    private Long id;
    /**
     * 菜品编号
     */
    private Long menusId;
    /**
     * 订单编号
     */
    private Long orderId;
    /**
     * 菜品名称
     */
    private String name;
    /**
     * 菜品数量
     */
    private Integer number;

    /**
     * 将DTO对象转换成entity对象
     *
     * @return entity对象
     */
    public MenusOrderRelationEntity toEntity() {
        return MenusOrderRelationEntity.builder()
                .id(id)
                .menusId(menusId)
                .orderId(orderId)
                .name(name)
                .number(number)
                .build();
    }
}
